#ifndef __SWITCH_H
#define __SWITCH_H

#include "stm8s.h"

#define SWITCH_K0_PIN   GPIOA, GPIO_PIN_1
#define SWITCH_K1_PIN   GPIOA, GPIO_PIN_2

#define SWITCH_V0_PIN   GPIOC, GPIO_PIN_3
#define SWITCH_V1_PIN   GPIOC, GPIO_PIN_4

#define SWITCH_H1_PIN   GPIOC, GPIO_PIN_7
#define SWITCH_H2_PIN   GPIOC, GPIO_PIN_6
#define SWITCH_H3_PIN   GPIOC, GPIO_PIN_5


typedef struct
{
  uint8_t active;
  uint8_t status;
  uint8_t timer;
}type_switch;

void switch_init(void);
void switch_km(uint8_t value);
void switch_v(uint8_t value);
uint8_t switch_get_input(void);
uint8_t switch_get_output(void);
void switch_auto(void);
void switch_addk(void);
void switch_subk(void);
void switch_modbus(uint8_t *pc);
void switch_timer(void);

#endif